package zhr.chapter9;

import javax.swing.*;
import java.awt.*;

public class BorderLayoutFrame extends JFrame {
    private JButton button1;
    private JButton button2;
    private JButton button3;
    private JButton button4;
    private JButton button5;

    public BorderLayoutFrame() {
        button1 = new JButton("Button1");
        button2 = new JButton("Button2");
        button3 = new JButton("Button3");
        button4 = new JButton("Button4");
        button5 = new JButton("Button5");

        this.setLayout(new BorderLayout(20, 20));
        this.add(button1,BorderLayout.NORTH);
        this.add(button2,BorderLayout.SOUTH);
        this.add(button3,BorderLayout.WEST);
        this.add(button4,BorderLayout.EAST);
        this.add(button5,BorderLayout.CENTER);

        this.setTitle("BorderLayout边框式布局");
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setSize(600, 400);
        this.setVisible(true);
    }
}
